def xywh2xyxy(*box):
    """
        将 xywh 转换为左上角 xy 和右下角 xy
    """
    result = [box[0] - box[2] // 2, box[1] - box[3] // 2,
              box[0] + box[2] // 2, box[1] + box[3] // 2]
    return result


def xywh2xyah(*box):
    """
    将 xywh 转换为 x, y, aspect ratio and height
    """
    result = [box[0], box[1],
              box[2] / box[3], box[3]]
    return result


def xyah2xyxy(*box):
    """
    将 xyah 转换为左上角 xy 和右下角 xy
    """
    width = box[2] * box[3]
    result = [box[0] - width // 2, box[1] - box[3] // 2,
              box[0] + width // 2, box[1] + box[3] // 2]
    return result


def xyxy2xyah(*box):
    """
    将 xyxy 转换为 x, y, aspect ratio and height
    """
    result = [box[2] - box[0] // 2, box[3] - box[1] // 2,
              (box[2] - box[0]) / (box[3] - box[1]), box[3] - box[1]]
    return result


def xyxy2xywh(*box):
    """
    将xyxy转换为xywh
    """
    result = [
        box[2] - box[0] // 2, box[3] - box[1] // 2,
        box[2] - box[0], box[3] - box[1]
    ]
    return result


def xyah2xywh(*box):
    result = [box[0], box[1],
              box[2] * box[3], box[3]]
    return result
